/*
* @Author: Turbidsoul
* @Date:   2017-01-05 22:54:19
* @Last Modified by:   Turbidsoul Chen
* @Last Modified time: 2017-01-09 18:16:18
*/

'use strict';

import React, { Component } from 'react';
import {Breadcrumb} from 'amazeui-react';
import {LinkContainer} from 'react-router-amazeui';
import {withRouter} from 'react-router';

class BreadcrumbBar extends Component {
  static propTypes = {
    router: React.PropTypes.object.isRequired
  };
  render() {
    console.log(this.props.router);
    return (
      <Breadcrumb slash>
        {this.props.router.routes.map((item, idx)=>{
          if(item.path) {
            return (
              <LinkContainer to={item.path} key={idx}>
                <Breadcrumb.Item>{item.component.label}</Breadcrumb.Item>
              </LinkContainer>
            );
          }
        })}
      </Breadcrumb>
    );
  }
}

export default withRouter(BreadcrumbBar);
